Back to course home
0% completed
Vote For New Content
Oracle Hard
Integer to English Words (hard)
Solution: Integer to English Words
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Merge K Sorted Lists (hard)
Solution: Merge K Sorted Lists
Max Points on a Line (hard)
Solution: Max Points on a Line
Sudoku Solver (hard)
Solution: Sudoku Solver
Longest Valid Parentheses (hard)
Solution: Longest Valid Parentheses
Remove Nth Node From End of List (Medium)
Solution: Remove Nth Node From End of List
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Constrained Subsequence Sum (hard)
Solution: Constrained Subsequence Sum
Longest Substring Without Repeating Characters (medium)
Problem Statement
Given a string, identify the length of its longest segment that contains distinct characters. In other words, find the maximum length of a substring that has no repeating characters.
Examples:
-
Example 1:
- Input: "abcdaef"
- Expected Output: 6
- Justification: The longest segment with distinct characters is "bcdaef", which has a length of 6.
-
Example 2:
- Input: "aaaaa"
- Expected Output: 1
- Justification: The entire string consists of the same character. Thus, the longest segment with unique characters is just "a", with a length of 1.
-
Example 3:
- Input: "abrkaabcdefghijjxxx"
- Expected Output: 10
- Justification: The longest segment with distinct characters is "abcdefghij", which has a length of 10.
Constraints:
- 0 <= s.length <= 5 * 104
sconsists of English letters, digits, symbols and spaces.
Try it yourself
Try solving this question here:
Java
. . . .
Solution: Remove Duplicate Letters
Solution: Longest Substring Without Repeating Characters (medium)
Mark as Completed
On this page
Problem Statement
Try it yourself